package com.run.guifeng.util;

import com.run.guifeng.model.dto.OrderDTO;
import com.run.guifeng.model.entity.Order;

import java.text.SimpleDateFormat;
import java.util.Date;

public class OrderDTOUtil {
    public static Order initOrder(OrderDTO orderDTO){
        Order order = new Order();
        String orderNo = new SimpleDateFormat("yyyymmddhhMMss").format(new Date());
        order.setOrderNo(orderNo);
        order.setUserId(orderDTO.getUserid());
        order.setTotalPrice(orderDTO.getTotalPrice());
        order.setUserAddress(orderDTO.getUserAddress());
        order.setUserPhone(orderDTO.getUserphone());
        order.setUserName(orderDTO.getUsername());
        return order;
    }
}
